﻿//////////////////////////////////////////////////////////////////////////
//UnselectableText.js                                                   //
//Written by: Sam Burich                                                //
//Adapted from: http://stackoverflow.com/questions/2310734/             //
//Last Edited: 23 Mar 2012                                              //
//                                                                      //
//This script makes text within <span> tags unselectable by users.      //
//////////////////////////////////////////////////////////////////////////
window.onload = function () {
    var labels = document.getElementsByTagName('span');
    for (var i = 0; i < labels.length; i++) {
        disableSelection(labels[i]);
    }
};
function disableSelection(element) {
    if (typeof element.onselectstart != 'undefined') {
        element.onselectstart = function () { return false; };
    } else if (typeof element.style.MozUserSelect != 'undefined') {
        element.style.MozUserSelect = 'none';
    } else {
        element.onmousedown = function () { return false; };
    }
}